//
//  JGoAPI.h
//  jungoo
//
//  Created by Sinbad Fly on 8/15/12.
//  Copyright (c) 2012 ABOM. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "JSON.h"
#import "Utility.h"

#define NDEBUG 1

#ifdef NDEBUG
#define DDBG DBG(@"")
#define DBG(xx) NSLog(@"%p %s (%d): %@", self, __PRETTY_FUNCTION__, __LINE__, xx)
#define DBGRECT(xx) DBG(NSStringFromCGRect(xx))
#define DBGPOINT(xx) DBG(NSStringFromCGPoint(xx))
#define LOG(xx, ...) NSLog(@"%p %s (%d): %@", self, __PRETTY_FUNCTION__, __LINE__, [NSString stringWithFormat:xx, ##__VA_ARGS__])
#else
#define DDBG 
#define DBG(xx) 
#define DBGRECT(xx) 
#define DBGPOINT(xx) 
#define LOG(xx, ...) 
#endif

#define JGO_HOST (@"http://5.79.0.122")
//#define JGO_HOST (@"http://demo.vmodev.com/jungoo")

#define JGO_ERROR_DOMAIN (@"jgo.error.com")
#define JGO_ERROR_CODE_NETWORK          0x100
#define JGO_ERROR_CODE_DATA             0x101
#define JGO_ERROR_CODE_UNKNOW           0x102
#define JGO_ERROR_CODE_FROM_SERVER      0x103

@interface JGoAPI : NSObject

// University
+ (NSArray*)getUniversity:(NSError**)error;

// Modules
+ (NSArray*)getModules:(NSError**)error;

// Courses
+ (NSArray*)getCourses:(NSError**)error;

// Colleges
+ (NSArray*)getColleges:(NSError**)error;

// Register new account
+ (BOOL)registerAccountWithName:(NSString*)name surname:(NSString*)surname 
                         email:(NSString*)email password:(NSString*)password 
                     university:(NSString*)university lat:(NSString*)lat 
                            lon:(NSString*)lon error:(NSError**)error;

+ (BOOL)updateProfileWithUserId:(NSString*)userId name:(NSString*)name surname:(NSString*)surname birthDay:(NSString*)birthDay
                         gender:(NSString*)gender email:(NSString*)email
                         status:(NSString*)status college:(NSString*)college
                     university:(NSString*)university course:(NSString*)course
                         u_year:(NSString*)u_year c_year:(NSString*)c_year
                         degree:(NSString*)degree modules:(NSString*)modules
                          thumb:(NSString*)thumb error:(NSError**)error;

// Login
+ (NSDictionary*)loginWithEmail:(NSString*)email andPassword:(NSString*)password error:(NSError**)error;

// login fb
+ (NSDictionary*)loginWithFacebookId:(NSString*)facebookId fb_name:(NSString*)fb_name 
                                 fb_dob:(NSString*)fb_dob gender:(NSString*)fb_gender 
                            fb_email:(NSString*)fb_email fb_username:(NSString*)fb_username 
                               error:(NSError**)error;

// Get People
+ (NSArray*)getPeopleWithUserId:(NSString*)userId searchBy:(NSString*)searchBy 
                          isFav:(BOOL)isFav filter:(NSString*)filter 
                            lat:(NSString*)lat lon:(NSString*)lon error:(NSError**)error;

// Download Avatar
+ (UIImage*)downloadAvatar:(NSString*)suffixLink error:(NSError**)error;

// Add to my favorites
+ (NSDictionary*)addFavoriteWithUserId:(NSString*)userId peopleId:(NSString*)peopleId error:(NSError**)error;

// Offer
+ (NSDictionary*)getOffersWithUserId:(NSString*)userId lat:(NSString*)lat lon:(NSString*)lon category:(NSString*)cat_id error:(NSError**)error;

// Get Photo
+ (NSArray*)getPhotoWithUserId:(NSString*)userId error:(NSError**)error;

// Event List with Today & Upcomming
+ (NSDictionary*)getEventsWithUserId:(NSString*)userId lat:(NSString*)lat lon:(NSString*)lon error:(NSError**)error;

// Get People Blocked
+ (NSArray*)getPeopleBlockedWithUserId:(NSString*)userId error:(NSError**)error;

// Update Location
+ (BOOL)setLocationWithUserId:(NSString*)userId lat:(NSString*)lat lon:(NSString*)lon error:(NSError**)error;

// Send feedback
+ (BOOL)sendFeedbackWithUserId:(NSString*)userId type:(NSString*)type content:(NSString*)content error:(NSError**)error;

// Block User
+ (BOOL)blockPersonWithUserID:(NSString*)userId  blockedUser:(NSString*)blockedUserID error:(NSError**)error;

//Unblock
+ (BOOL)unblockPersonWithUserID:(NSString*)userId  UnblockedUser:(NSString*)unblockedUserID error:(NSError**)error;

// Upload Photo
+ (BOOL)uploadPhotoWithUserId:(NSString*)userId avatarData:(NSData*)avatarData error:(NSError**)error;

+ (BOOL)saveSettingsWithUserId:(NSString*)userId statusPublic:(BOOL)statusPublic 
                  coursePublic:(BOOL)coursePublic modulesPublic:(BOOL)modulesPublic 
                  u_yearPublic:(BOOL)u_yearPublic collegePublic:(BOOL)collegePublic 
                         error:(NSError**)error;

// Keep Live
+ (BOOL)keepAliveForUserId:(NSString*)userId error:(NSError**)error;

// Check Online
+ (NSDictionary*)getOnlineWithUserIds:(NSString*)userIds error:(NSError**)error;

//create new event
+ (BOOL)createNewEventsWithUserId:(NSString*)userId title:(NSString*)title type:(NSString*)type cirType:(NSString*)cirType cirValue:(NSString*)cirValue scope:(NSString*)scope eventDate:(NSString*)eventDate startTime:(NSString*)startTime endTime:(NSString*)endTime address:(NSString*)address description:(NSString*)description lat:(NSString*)lat lon:(NSString*)lon error:(NSError**)error;

// Get List Conversation
+ (NSArray*)getConversationsWithUserId:(NSString*)userId onlyOwner:(BOOL)onlyOwner error:(NSError**)error;

// Get Messages
+ (NSArray*)getMessagesWithUserId:(NSString*)userId conversationId:(NSString*)conversationId fromDate:(NSString*)fromDate toDate:(NSString*)toDate error:(NSError**)error;

// Add a Message to the Conversation
+ (BOOL)addMessageWithUserId:(NSString*)userId conversationId:(NSString*)conversationId 
                        type:(NSString*)type content:(NSString*)content error:(NSError**)error;

// Create a Conversation
+ (NSDictionary*)createConversationWithUserId:(NSString*)userId conversationName:(NSString*)conversationName
                                   inviteeIds:(NSString*)inviteeIds error:(NSError**)error;

// Get Offer
+ (NSDictionary*)getOfferDetailWithUserId:(NSString*)userId offerId:(NSString*)offerId error:(NSError**)error;

// Get Event
+ (NSDictionary*)getEventDetailWithUserId:(NSString*)userId eventId:(NSString*)eventId error:(NSError**)error;

// Count Message
+ (NSDictionary*)countMessagesWithUserId:(NSString*)userId activeConversationId:(NSString*)acid fromDate:(NSString*)fromDate error:(NSError**)error;

// Delete conversations

+ (BOOL)deleteConversationsWithUserId:(NSString*)userId conversationIds:(NSString*)cids error:(NSError**)error;

// Delete Messages

+ (BOOL)deleteMessagesWithMessageIds:(NSString*)mids error:(NSError**)error;

// Update event status
+ (BOOL)updateEventStatusWithUserId:(NSString*)userId eventId:(NSString*)eventId status:(NSString*)status error:(NSError**)error;

// Delete Events
+ (BOOL)deleteEventsWithUserId:(NSString*)userId eventIds:(NSString*)eventIds error:(NSError**)error;

@end
